<%@page import="helpers.UrlHelper"%>
<%@page import="entities.IpAddress"%>
<%
String ip = (String) request.getAttribute("ip");
IpAddress ipAddress = (IpAddress) request.getAttribute("ipAddress");

//Set content for seo
String title = "IP " + ip + " Infomation";
String description = "Ip " + ip  + " info: ip address, ip location, whois ip";
String keywords = ip + ",ip address,ip location,location,ip geo,whois ip,trace ip,ip info";
String url = UrlHelper.getServerUrl(request) + "/ip/" + ip;
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

	<script type="text/javascript" src="/js/ip.js"></script>
	
	<div class="row">
		<div class="span9">
			<div class="search-box">
				<div class="row">
					<div class="span3">
						<h4>Trace IP Address</h4>
					</div>
					<div class="span6">
						<form class="form-search" action="/goto" method="get">
							<div class="input-append">
							    <input type="text" class="span2 search-query input-xxlarge" name="q" placeholder="<%=ip%>">
							    <button type="submit" class="btn">Search</button>
							</div>
						</form>
					</div>
				</div>
				<div class="adv align-left">
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-4975603569119809";
					/* traceip_468x15 */
					google_ad_slot = "6636286518";
					google_ad_width = 468;
					google_ad_height = 15;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
				</div>
	  		</div>
	  		
	  		<hr >
	  		
	  		<div class="row">
	  			<% if (ipAddress != null) { %>
	  			<div class="span5">
	  				<h4>Ip Location</h4>
	  				<dl class="attributes clearfix">
						<dt>Country Code:</dt>
						<dd><%=ipAddress.getCountryCode() %></dd>
						<dt>Country Code3:</dt>
						<dd><%=ipAddress.getCountryCode3() %></dd>
						<dt>Country Name:</dt>
						<dd>
							<%=ipAddress.getCountryName() %>
						</dd>
						<dt>City:</dt>
						<dd><%=ipAddress.getCity() %></dd>
						<dt>Continent Code:</dt>
						<dd><%=ipAddress.getContinentCode() %></dd>
						<dt>Latitude:</dt>
						<dd><%=ipAddress.getLatitude() %></dd>
						<dt>Longitude:</dt>
						<dd><%=ipAddress.getLongitude() %></dd>
					</dl>
					<div class="adv align-left">
						<script type="text/javascript"><!--
						google_ad_client = "ca-pub-4975603569119809";
						/* traceip_234x60 */
						google_ad_slot = "5019952514";
						google_ad_width = 234;
						google_ad_height = 60;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>
					</div>
	  			</div>
	  			<div class="span4">
	  				<img src="http://maps.google.com/maps/api/staticmap?sensor=false&size=300x300&markers=size:mid|color:blue|label:1|<%=ipAddress.getLatitude() %>,<%=ipAddress.getLongitude() %>&markers=color:black|label:0|<%=ipAddress.getLatitude() %>,<%=ipAddress.getLongitude() %>">
	  			</div>
	  			<% } else { %>
	  			<div class="span5">
	  				<h4><%=ip %> is not valid Ip Address</h4>
	  				<br />
	  				<div class="adv align-left">
	  					<script type="text/javascript"><!--
						google_ad_client = "ca-pub-4975603569119809";
						/* traceip_200x200 */
						google_ad_slot = "9450152116";
						google_ad_width = 200;
						google_ad_height = 200;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>
	  				</div>
	  			</div>
	  			<div class="span4">
	  				<script type="text/javascript"><!--
					google_ad_client = "ca-pub-4975603569119809";
					/* traceip_250x250 */
					google_ad_slot = "1926885314";
					google_ad_width = 250;
					google_ad_height = 250;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
	  			</div>
	  			<% } %>
	  		</div>
	  		
	  		<hr >
			<% if (ipAddress != null && !ipAddress.getWhoisIp().isEmpty()) { %>
			<div class="whoisIp clearfix">
				<div class="adv right">
					<script type="text/javascript"><!--
					google_ad_client = "ca-pub-4975603569119809";
					/* traceip_250x250 */
					google_ad_slot = "1926885314";
					google_ad_width = 250;
					google_ad_height = 250;
					//-->
					</script>
					<script type="text/javascript"
					src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
					</script>
				</div>
				<h3>IP <%=ipAddress.getIp() %> Info</h3>
				<%=ipAddress.getWhoisIp() %>
			</div>
			<% } %>
		</div>
  		<jsp:include page="/elements/right.jsp" />
	</div>
	    
<jsp:include page="/layouts/footer.jsp" />